/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.model.vo.project;

import cn.ac.nercis.pes.common.constant.project.SpecialType;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import org.apache.commons.lang3.StringUtils;

/**
 * 特殊测评单元指标信息，修改视图模型
 * @author zpy
 * @version 1.0.0
 */
public class UnitSpecialTargetVO {
    private final SimpleStringProperty id = new SimpleStringProperty();
    private final SimpleStringProperty systemId = new SimpleStringProperty();
    private final SimpleStringProperty name = new SimpleStringProperty();
    private final SimpleObjectProperty<SpecialType> specialType = new SimpleObjectProperty<>();
    private final SimpleStringProperty targetDesc = new SimpleStringProperty();
    private final SimpleStringProperty reasons = new SimpleStringProperty();
    private final SimpleStringProperty layerTargetId = new SimpleStringProperty();
    private final SimpleStringProperty kmTargetId = new SimpleStringProperty();
    private final SimpleStringProperty kmApplyClaim = new SimpleStringProperty();
    private boolean change = false;

    public boolean isChange() {
        return change;
    }

    public void resetChange() {
        change = false;
    }

    public String getId() {
        return id.get();
    }

    public SimpleStringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    public String getSystemId() {
        return systemId.get();
    }

    public SimpleStringProperty systemIdProperty() {
        return systemId;
    }

    public void setSystemId(String systemId) {
        this.systemId.set(systemId);
    }

    public String getName() {
        return name.get();
    }

    public SimpleStringProperty nameProperty() {
        return name;
    }

    public void setName(String name) {
        if (!StringUtils.equals(getName(), name)) {
            change = true;
        }
        this.name.set(name);
    }

    public SpecialType getSpecialType() {
        return specialType.get();
    }

    public SimpleObjectProperty<SpecialType> specialTypeProperty() {
        return specialType;
    }

    public void setSpecialType(SpecialType specialType) {
        if (getSpecialType() != specialType) {
            change = true;
        }
        this.specialType.set(specialType);
    }

    public String getTargetDesc() {
        return targetDesc.get();
    }

    public SimpleStringProperty targetDescProperty() {
        return targetDesc;
    }

    public void setTargetDesc(String targetDesc) {
        if (!StringUtils.equals(getTargetDesc(), targetDesc)) {
            change = true;
        }
        this.targetDesc.set(targetDesc);
    }

    public String getReasons() {
        return reasons.get();
    }

    public SimpleStringProperty reasonsProperty() {
        return reasons;
    }

    public void setReasons(String reasons) {
        if (!StringUtils.equals(getReasons(), reasons)) {
            change = true;
        }
        this.reasons.set(reasons);
    }

    public String getLayerTargetId() {
        return layerTargetId.get();
    }

    public SimpleStringProperty layerTargetIdProperty() {
        return layerTargetId;
    }

    public void setLayerTargetId(String layerTargetId) {
        this.layerTargetId.set(layerTargetId);
    }

    public String getKmTargetId() {
        return kmTargetId.get();
    }

    public SimpleStringProperty kmTargetIdProperty() {
        return kmTargetId;
    }

    public void setKmTargetId(String kmTargetId) {
        this.kmTargetId.set(kmTargetId);
    }

    public String getKmApplyClaim() {
        return kmApplyClaim.get();
    }

    public SimpleStringProperty kmApplyClaimProperty() {
        return kmApplyClaim;
    }

    public void setKmApplyClaim(String kmApplyClaim) {
        if (!StringUtils.equals(getKmApplyClaim(), kmApplyClaim)) {
            change = true;
        }
        this.kmApplyClaim.set(kmApplyClaim);
    }
}